﻿using System.Collections.Generic;
using UnityEngine;

public class WorldRuler : MonoBehaviour
{

    public bool m_bShowM;    // 显示米
    public bool m_bShow10Cm; // 显示分米

    public int m_nArea = 100;
    class Line
    {
        public Vector3 start;
        public Vector3 end;
    }
    List<Line> m_ListX = new List<Line>();
    List<Line> m_ListZ = new List<Line>();
    // Use this for initialization
    void Start()
    {
        for (int i = -m_nArea; i < m_nArea; ++i)
        {
            var line = new Line();
            line.start.x = i;
            line.start.y = 0;
            line.start.z = -m_nArea;

            line.end = line.start;
            line.end.z = m_nArea;
            m_ListX.Add(line);

            var line2 = new Line();
            line2.start.x = -m_nArea;
            line2.start.y = 0;
            line2.start.z = i;

            line2.end = line2.start;
            line2.end.x = m_nArea;
            m_ListZ.Add(line2);
        }
    }

    // Update is called once per frame
    void OnDrawGizmos()
    {
        Gizmos.color = Color.green;
        for (int i = 0; i < m_ListX.Count; ++i)
        {
            Gizmos.DrawLine(m_ListX[i].start, m_ListX[i].end);
            Gizmos.DrawLine(m_ListZ[i].start, m_ListZ[i].end);
        }
    }
}
